package com.atguigu.demo.customer.mapper;


import com.atguigu.demo.customer.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("demo")
public interface CustomerMapper extends BaseMapper<Customer> {

    // sql的定义 可以写xml  也可以写注解
    @Insert("insert into  customer values ( #{customer.id},#{customer.name},#{customer.age} ) ")
    public  void  insertCustomer( @Param("customer") Customer customer);


    @Select("select id,name,age from customer where id=#{id}")
    public  Customer  selectCustomerById(@Param("id") Integer id);

    @Select("select id,name,age from customer where name like #{customer.name}")
    public List<Customer> selectCustomer(@Param("customer") Customer customer);


    // update

    // delete


}
